//
//  MapOverlay.m
//  mkoverlaytest
//
//  Created by NgoThang on 11/18/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import "MapOverlay.h"

@implementation MapOverlay
@synthesize coordinate;

- (id)initWithCoordinate:(CLLocationCoordinate2D)c
{
    self = [super init];
    if (self) {
        //self.coordinate = c;
    }
    return self;
}

- (id)initWithType:(NSInteger)_type 
{
    self = [super init];
    if (self) {
        // 0: large; 1: small
        type = _type; 
    }
    return self;
}

- (id)initWithType:(NSInteger)_type andZoomLevel:(NSInteger)_zoom_level
{
    self = [super init];
    if (self) {
        // 0: large; 1: small
        type = _type; 
        
        // 10: large; 14: small
        zoom_level = _zoom_level;
    }
    return self;
}

- (MKMapRect)boundingMapRect
{
    MKMapPoint upperLeft = MKMapPointForCoordinate(self.coordinate);
    MKMapRect bounds;
    
    NSInteger c, o;
    
    if (zoom_level == 10) {
        if (!type) {
            c = 60000;
            o = 120000;
        }
        else {
            c = 50000;
            o = 100000;
        }
    }
    else {
        if (!type) {
            c = 3550;
            o = 7100;
        }
        else {
            c = 3180;
            o = 6360;
        }
    }
    
    bounds = MKMapRectMake(upperLeft.x-c, upperLeft.y-c, o, o);
    
    return bounds;
}


@end
